package com.nasarius.bank.scorecard.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.nasarius.bank.scorecard.dao.FactorsDAO;
import com.nasarius.bank.scorecard.domain.Factors;
import com.nasarius.bank.scorecard.domain.FactorsExample;
@Repository
public class FactorsDAOImpl extends SqlMapClientDaoSupport implements FactorsDAO {

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table factors
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
	@Autowired
    public FactorsDAOImpl(/*@Qualifier("sqlMapClient")*/SqlMapClient sqlMapClient) {
        super();
        setSqlMapClient(sqlMapClient);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table factors
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    public int countFactorsByExample(FactorsExample example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("factors.ibatorgenerated_countByExample", example);
        return count;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table factors
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    public int deleteFactorsByExample(FactorsExample example) {
        int rows = getSqlMapClientTemplate().delete("factors.ibatorgenerated_deleteByExample", example);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table factors
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    public void insertFactors(Factors record) {
        getSqlMapClientTemplate().insert("factors.ibatorgenerated_insert", record);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table factors
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    public void insertFactorsSelective(Factors record) {
        getSqlMapClientTemplate().insert("factors.ibatorgenerated_insertSelective", record);
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table factors
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    @SuppressWarnings("unchecked")
    public List<Factors> selectFactorsByExample(FactorsExample example) {
        List<Factors> list = getSqlMapClientTemplate().queryForList("factors.ibatorgenerated_selectByExample", example);
        return list;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table factors
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    public int updateFactorsByExampleSelective(Factors record, FactorsExample example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("factors.ibatorgenerated_updateByExampleSelective", parms);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table factors
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    public int updateFactorsByPrimaryKey(Factors record) {
        int rows = getSqlMapClientTemplate().update("factors.ibatorgenerated_updateByPrimaryKey", record);
        return rows;
    }

    /**
     * This class was generated by Apache iBATIS ibator.
     * This class corresponds to the database table factors
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    private static class UpdateByExampleParms extends FactorsExample {
        private Object record;

        public UpdateByExampleParms(Object record, FactorsExample example) {
            super(example);
            this.record = record;
        }

        @SuppressWarnings("unused")
		public Object getRecord() {
            return record;
        }
    }

    @SuppressWarnings("unchecked")
	public List<Factors> selectAllFactors() {
		 List<Factors> list = getSqlMapClientTemplate().queryForList("factors.ibatorgenerated_selectAll");
	        return list;
	}
    
    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table factors
     *
     * @ibatorgenerated Sun Mar 13 00:13:58 IST 2011
     */
    public int deleteFactorsByPrimaryKey(Integer factorid) {
    	Factors factors = new Factors();
    	factors.setFactorid(factorid);
        int rows = getSqlMapClientTemplate().delete("factors.ibatorgenerated_deleteByPrimaryKey", factors);
        return rows;
    }
}